package com.ppz.mapper;


import com.ppz.dao.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserDao {

    //用户登录
    @Select("select * from users where phone=#{phone} and password=#{password}")
    public User loginUser(String phone, String password);

    //判断手机号是否存在
    @Select("select * from users where phone =#{phone}")
    public User isExistUser(String phone);

    //用户创建
    @Insert("insert into users(phone,username,password,age,remark) values (#{phone},#{username},#{password},#{age},#{remark})")
    public void addUser(User user);

    //用户信息修改
    @Update("update users set phone = #{user.phone}, username = #{user.username}, password = #{user.password}, age = #{user.age}, remark = #{user.remark} ")
    public void updateUser(User user);

    //获取用户信息
    @Select("select * from users where phone=#{phone}")
    public User getUserByPhone(String phone);

    //删除用户
    @Delete("delete from users where phone=#{phone}")
    public boolean deleteUserByPhone(String phone);
}